--
-- Author: shunguo.chen
-- Date: 2017-11-28 13:50:12
--
-- MountSpeedView  骑术界面

local fileName = string.getModeName(...)
local ClassRef = class(fileName, app.mvc.ViewBase)

ClassRef.VIEW_ROOT_RES = Res.MountSpeedScene

local SPEED_LV_STR = L("lua_code_text_181")
local SPEED_EFFECT_STR = L("lua_code_text_156")
local SPEED_NEED_STR = L("lua_code_text_491")

function ClassRef:init()
    display.nodeRemoveForNotHit(self._ui.Panel, function()
        executeFunc(self._onCloseView, self)
    end)

    self._dotIcon1 = self._ui["Panel/Panel_bg/dot1"]
    self._lvText =  self._ui["Panel/Panel_content/title_1"]
    self._curText =  self._ui["Panel/Panel_content/riding_1_num"]
    self._nextText =  self._ui["Panel/Panel_content/riding_2_num"]
    self._needText =  self._ui["Panel/Panel_content/riding_3_num"]

end

function ClassRef:refresh(params)
    self._lvText:setString(string.format(SPEED_LV_STR, params.curLv))
    local width = self._lvText:getVirtualRendererSize().width
    self._dotIcon1:setContentSize(cc.size(width + 40, self._dotIcon1:getContentSize().height))

    self._curText:setString(string.format(SPEED_EFFECT_STR, params.curSpeed))

    if params.hasNum >= params.needNum then
        self._nextText:setVisible(false)
        self._needText:setVisible(false)
        self._ui["Panel/Panel_bg/line"]:setVisible(false)
        self._ui["Panel/Panel_bg/dot2"]:setVisible(false)
        self._ui["Panel/Panel_content/title_2"]:setString(L("mountTips1"))
    else
        self._nextText:setString(string.format(SPEED_EFFECT_STR, params.nextSpeed))
        self._needText:setString(string.format(SPEED_NEED_STR, params.hasNum, params.needNum))
    end
   
end




return ClassRef